import { useDateFormat } from '@vueuse/core';

export const dateTimeToDate = (dateTimeStamp: string): string =>
  dateTimeStamp && useDateFormat(dateTimeStamp, 'YYYY年MM月DD日').value;

export const dateTimeToDateTime = (dateTimeStamp: string): string =>
  dateTimeStamp && useDateFormat(dateTimeStamp, 'YYYY年MM月DD日HH时mm分').value;

export const ndeMethodNameConvertor = (
  _row: any,
  _column: any,
  cellValue: 'RT' | 'UT' | 'MT' | 'PT' | 'ET' | 'LT' | 'VT'
): '射线检测' | '超声检测' | '磁粉检测' | '渗透检测' | '涡流检测' | '泄漏检测' | '目视检测' => {
  switch (cellValue) {
    case 'RT':
      return '射线检测';
    case 'UT':
      return '超声检测';
    case 'MT':
      return '磁粉检测';
    case 'PT':
      return '渗透检测';
    case 'ET':
      return '涡流检测';
    case 'LT':
      return '泄漏检测';
    case 'VT':
      return '目视检测';
  }
};

export const ndeMethodLevelConvertor = (
  _row: any,
  _column: any,
  cellValue: 1 | 2 | 3
): 'Ⅰ' | 'Ⅱ' | 'Ⅲ' => {
  switch (cellValue) {
    case 1:
      return 'Ⅰ';
    case 2:
      return 'Ⅱ';
    case 3:
      return 'Ⅲ';
  }
};
